import pymysql

db = pymysql.connect(
    host='localhost',
    port=3307,
    user='root',
    password='123456',
    database='myschools',
    charset='utf8'
)
print(type(db))
print(db.get_host_info())
print(db.get_server_info())
# 关闭连接
db.close()
